package com.grace.law.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.grace.law.bean.Event;
import com.grace.law.bean.EventTask;
import com.grace.law.dao.EventMapper;

@Service
public class EventTaskService {

	@Autowired
	EventMapper mapper;
	
	

	public List<EventTask> getTaskList(String appPath) {
		List<EventTask> taskList = new ArrayList<>(); 
		
		List<Event> events = mapper.selectTasksByMonth();
		for(Event event:events){
			EventTask task = new EventTask();
			task.setId(event.getEid());
			task.setTitle(event.getEventName()+":"+event.getCustomerName());
			task.setStart(event.getEventTouchTime());
			task.setColor("#ff9f89");
			task.setUrl(appPath+"/caseremark/init/"+event.getCustomerId());
			taskList.add(task);
		}
		
		return taskList;
	}



	public int insert(Event event) {
		return mapper.insertSelective(event);
		
	}
}
